home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1999 #2
/
Amiga Plus CD - 1999 - No. 2.iso
/
System-Boost
/
Grafik
/
AmiCAD
/
ARexx_english
/
ImportText.AmiCAD
< prev
next >
Wrap
Text File
|
1998-06-17
|
2KB
|
72 lines
/* Import a text in a box */
/* $VER: ImportText 1.00e (© R.Florac, 24 mai 1998) */
/* Bug: don't handle the quotes ("), the current scale and placement mode */
/* Only use the left and top borders of the selected box */
options results
signal on error
signal on syntax
'FIRSTSEL'; obj=result
if obj>0 then do
'TYPE('obj')'
if result=22 then do
'NEXTSEL('obj')'
if result=0 then do
'COORDS('obj')';
PARSE VAR result x0 ',' y0 ',' x1 ',' y1
xg=minima(x0,x1); xd=maxima(x0,x1)
yh=minima(y0,y1); yb=maxima(y0,y1)
'REQFILE("Name of the text file?", "Work:text/ASCII")'; fichier=result
if fichier ~= "" then do
if open(file, fichier, 'R') then do
y0=y0+10
'SAVEALL(-1)'
do while y0 < y1
ligne=readln(file)
if ligne ~= "" then do
ligne=translate(ligne," ",'09'x)
'WRITE("'ligne'",'x0','y0')'; e=result
if e=0 then do
'REQUEST("Text placement in line"+CHR(10)+"'ligne'"+CHR(10)+"impossible."+CHR(10)+"Do you want to continue?")'
if result=0 then leave
end
y0=y0+10
end
if eof(file) then leave
end
close(file)
end
end
exit
end
end
end
'MESSAGE("Draw and select a box"+CHR(10)+"where you want to"+CHR(10)+"put the text")'
exit
minima: procedure
parse arg v1,v2
if v1<v2 then return v1
return v2
end
maxima: procedure
parse arg v1,v2
if v1>v2 then return v1
return v2
end
/* Traitement des erreurs, interruption du programme */
syntax:
erreur=RC
'MESSAGE("Script ImportText.AmiCAD"+CHR(10)+"Syntax error"+CHR(10)+"in line 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
exit
error:
'MESSAGE("Script ImportText.AmiCAD"+CHR(10)+"Error in line 'SIGL'")'
exit